
from sqlalchemy import Column, Integer, String
from db import Base


class User(Base):
    __tablename__ = "users"
    id = Column(Integer, primary_key=True, index=True)
    phone = Column(String(50), nullable=False, unique=True)
    name = Column(String(50), nullable=False, unique=True)
    password = Column(String(100), nullable=False)
    avatar = Column(String(100), nullable=False)

class Root(Base):
    __tablename__ = "root"
    id = Column(Integer, primary_key=True, index=True)
    phone = Column(String(50), nullable=False, unique=True)
    name = Column(String(50), nullable=False, unique=True)
    password = Column(String(100), nullable=False)
    avatar = Column(String(100), nullable=False)

class Product(Base):
    __tablename__ = "product"
    id = Column(Integer, primary_key=True, index=True,autoincrement=True)
    name = Column(String(50), nullable=False,primary_key=True)
    price = Column(Integer, nullable=False)
    color=Column(String(50), nullable=False)
    spec=Column(String(50), nullable=False)
    model = Column(String(50), nullable=False)
    description = Column(String(1024), nullable=False)
    image = Column(String(100), nullable=False)

class official(Base):
    __tablename__ = "official"
    id = Column(Integer, primary_key=True, index=True,autoincrement=True)
    name = Column(String(50), nullable=False,primary_key=True)
    image=Column(String(100), nullable=False)
    description = Column(String(1024), nullable=False)